ConfigAction

class ConfigAction @JvmOverloads constructor(titleSupplier: Supplier<Text>, activeSupplier: Supplier<Boolean>, pressAction: Runnable, decoration: Identifier, description: Text? = null, background: ActiveButtonWidget.Background? = null) : EntryWidget<Any> , EntryFlag, Translatable

Builds a button that will appear in a Config GUI, to perform some arbitrary, possible non-config-related action

This could be used to link to a wiki, open another non-fzzy-config config, open a non-config screen, open a patchouli guide, run a command, and so on.

Author

fzzyhmstrs

Since

0.5.0

Parameters

titleSupplier

Supplier - supplies a name for the button widget. Will be checked every frame, so the button name will dynamically update as needed.

activeSupplier

Supplier - supplies an active state; whether the button is insactive ("greyed out" and unclickable) or active (functioning normally)

pressAction

Runnable - the action to execute on clicking the button

background

Identifier, nullable - if non-null, will provide a custom background for the widget rendering.

decoration

Identifier, nullable - if non-null, will render a "decoration" next to the widget. These are the typically white/wireframe icons shown next to certain settings like lists.

Constructors

Link copied to clipboard
constructor(titleSupplier: Supplier<Text>, activeSupplier: Supplier<Boolean>, pressAction: Runnable, decoration: Identifier, description: Text? = null, background: ActiveButtonWidget.Background? = null)

Types

Link copied to clipboard
class Builder

Builds a ConfigAction

Functions

Link copied to clipboard
open override fun description(fallback: String?): MutableText

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.

Link copied to clipboard
open override fun descriptionKey(): String

translation key of this Translatable's description. the "description" in-game, the descriptions Enchantment Descriptions adds to enchantment tooltips are a good example.

Link copied to clipboard
open fun flags(): Byte
Link copied to clipboard
open override fun hasDescription(): Boolean

Whether this Translatable has a valid description

Link copied to clipboard
open override fun hasFlag(flag: EntryFlag.Flag): Boolean
Link copied to clipboard
open override fun hasTranslation(): Boolean

Whether this Translatable has a valid translation

Link copied to clipboard
open fun translation(fallback: String? = null): MutableText

The translated Text name from the translationKey. Falls back to the implementing classes Simple Name (non-translated)

Link copied to clipboard
open override fun translationKey(): String

translation key of this Translatable. the "name" in-game

Link copied to clipboard
open fun widgetAndTooltipEntry(choicePredicate: ChoiceValidator<Any> = ChoiceValidator.any()): ClickableWidget